#include <bits/stdc++.h>
// 2025/04/05
// tag: 
// Author: Forever
using namespace std;

class Difference {
public:
    vector<int> diff;
    Difference(vector<int>& nums)
    {
        diff = nums;
    }

    Difference(int n)
    {
        diff = vector<int>(n);
    }

    void increment(int i, int j, int val)
    {
        diff[i] += val;
        if (j + 1 < diff.size()) {
            diff[j + 1] -= val;
        }
    }

    vector<int> get()
    {
        vector<int> res;
        // 根据差分数组构造结果数组
        res.push_back(diff[0]);
        for (int i = 1; i < diff.size(); i++) {
            res.push_back(res[i - 1] + diff[i]);
        }
        return res;
    }
};